<!--  -->
<template>
  <div>
    <div class="type_dialog">
      <el-dialog :visible.sync="dialogVisible" width="500px" height="210px">
        <template slot="title">
          <div class="tishi">
            <span> {{ title }}</span>
          </div>
        </template>
        <div class="">
          <el-input
            type="textarea"
            placeholder="请输入回复内容"
            v-model="typetext"
            resize="none"
            :autosize="{ minRows: 4 }"
          >
          </el-input>
          <slot></slot>
        </div>
        <div slot="footer" class="dialog-footer">
          <button class="btn_add" @click="showType">确 定</button>
          <button @click="dialogVisible = false" class="can_btn">取 消</button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      typetext: '',
      dialogVisible: false,
      istype: '', //操作类型
      title: ''
    }
  },
  props: {},
  created() {},
  methods: {
    showdialog(title, type, name) {
      this.title = ''
      this.dialogVisible = true
      this.istype = type
      this.title = title
      if (this.istype == 'chang') {
        this.typetext = name
      } else {
        this.typetext = ''
      }
    },
    showType() {
      if (this.typetext == '') {
         this.$message.error('请输入内容');
      } else {
        if (this.istype == 'reply') {
          this.dialogVisible = false
          this.$emit('showType', this.istype, this.typetext)
        } else if (this.istype == 'chang') {
          this.dialogVisible = false
          this.$emit('showType', this.istype, this.typetext)
        }
      }
    }
  }
}
</script>

<style scoped lang="scss">
@import './style.scss';
</style>
